package com.opgea.tutor.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.opgea.tutor.domain.model.Authorization;
import com.opgea.tutor.domain.model.Page;
import com.opgea.tutor.domain.model.StringBinding;
import com.opgea.tutor.domain.qualifiers.UserType;

public class ApplicationServiceImpl {

    private static final String REDIRECT = "?faces-redirect=true";

    public static List<Page> getPageList(UserType userType) {
	List<Page> pageList = new ArrayList<Page>();
	if (userType.equals(UserType.Tutor)) {
	    pageList.add(new Page(1, "/tutor/image/create.xhtml" + REDIRECT,
		    "Upload Image"));
	    pageList.add(new Page(2, "/tutor/personaldetails/create.xhtml"
		    + REDIRECT, "Personal Details"));
	    pageList.add(new Page(3, "/tutor/address/create.xhtml" + REDIRECT,
		    "Address"));
	    pageList.add(new Page(4, "/tutor/phone/create.xhtml" + REDIRECT,
		    "Phones"));
	    pageList.add(new Page(5, "/tutor/email/create.xhtml" + REDIRECT,
		    "Emails"));
	    pageList.add(new Page(6, "/tutor/educationaldetails/create.xhtml"
		    + REDIRECT, "Educational Details"));
	    pageList.add(new Page(7, "/tutor/specialization/create.xhtml"
		    + REDIRECT, "Specialization"));
	    pageList.add(new Page(8, "/tutor/profile/create.xhtml" + REDIRECT,
		    "Upload Profile"));
	    pageList.add(new Page(9, "/tutor/location/create.xhtml" + REDIRECT,
		    "Reachable Location"));
	    pageList.add(new Page(10, "/tutor/tutorpost/create.xhtml"
		    + REDIRECT, "Post"));
	}
	if (userType.equals(UserType.Student)) {
	    pageList.add(new Page(1, "/student/personaldetails/create.xhtml"
		    + REDIRECT, "Personal Details"));
	    pageList.add(new Page(2, "/student/educationaldetails/create.xhtml"
		    + REDIRECT, "Educational Details"));
	    pageList.add(new Page(3,
		    "/student/address/create.xhtml" + REDIRECT, "Address"));
	    pageList.add(new Page(4, "/student/phone/create.xhtml" + REDIRECT,
		    "Phones"));
	    pageList.add(new Page(5, "/student/email/create.xhtml" + REDIRECT,
		    "Emails"));
	    pageList.add(new Page(6, "/student/studentpost/create.xhtml"
		    + REDIRECT, "Post"));
	}
	if (userType.equals(UserType.Admin)) {

	}
	return pageList;
    }

    public static List<StringBinding> getActionList(int pageId,
	    int accessLevelId) {
	List<StringBinding> menuList = new ArrayList<StringBinding>();
	menuList.add(new StringBinding("new.xhtml" + REDIRECT, "New"));
	menuList.add(new StringBinding("list.xhtml" + REDIRECT, "View All"));
	return menuList;
    }

    public static List<Authorization> getAllAuthorizations(int pageId,
	    int accessLevelId) {
	return null;
    }
}
